package com.neusoft.neuiotms.dcom.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 厅局驻场变更日志
 *
 * @author sunchf
 */
@Getter
@Setter
@ToString
@Entity
@org.hibernate.annotations.Table(appliesTo = "neuiot_resident_change_log", comment = "厅局驻场变更日志")
@Table(name = "neuiot_resident_change_log")
public class ResidentChangeLog extends AbstractModel {

    private static final long serialVersionUID = 1L;

    /** 关联单位 */
    @ManyToOne
    private Institutions institutions;

    /** 关联驻场人员（一线运维人员） */
    @OneToMany(mappedBy = "residentChangeLog", cascade = {CascadeType.ALL })
    @LazyCollection(LazyCollectionOption.FALSE)
    private List<ResidentChangeUser> residents = new ArrayList<>();

    /** 变更时间 */
    private Date changeAt = new Date();
}
